/*
 * noisetexture.h
 *
 * Copyright 2012 The University of Auckland
 *
 *  Created on: 20/06/2012
 *      Author: ccve
 */

#ifndef VRN_NOISETEXTURE_H
#define VRN_NOISETEXTURE_H

#include "voreen/core/processors/renderprocessor.h"
#include "voreen/core/properties/optionproperty.h"
#include "modules/flowreen/processors/flowreenprocessor.h"
#include "modules/flowreen/datastructures/simpletexture.h"

#include "voreen/core/ports/renderport.h"
#include "voreen/core/properties/filedialogproperty.h"
#include "voreen/core/properties/vectorproperty.h"
#include "voreen/core/properties/buttonproperty.h"
#include "tgt/shadermanager.h"

namespace voreen {

class NoiseTexture : public RenderProcessor {
public:
	NoiseTexture();

    // virtual constructor
    virtual Processor* create() const;

    // documentary functions
    virtual std::string getClassName() const { return "NoiseTexture";       }
    virtual std::string getCategory() const  { return "Image Generating";      }
    virtual CodeState getCodeState() const   { return CODE_STATE_EXPERIMENTAL; }


    void generateWhiteNoise(int numElements);
    void generateSparseNoise(int numElements);

protected:
    virtual void setDescriptions() {
        setDescription("Generates a white noise texture of desired dimensions.");
    }

    // actual rendering code
    virtual void process();

    /// loads the shader
    virtual void initialize() throw (VoreenException);

    /// frees the shader
    virtual void deinitialize() throw (VoreenException);

private:
    RenderPort outport_;

    IntProperty prop_xdim;
    IntProperty prop_ydim;

    tgt::Texture* noiseTexture_;

    float* const data_;
};

} // namespace

#endif // VRN_NOISETEXTURE_H
